﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using ShiXuLong.Service;
namespace ShiXuLong.Admin.Controllers
{
    [Authorize]
    public class GuideController : Controller
    {
        Guide cd = new Service.Guide();
        // GET: Guide
        public ActionResult Index()
        {
            return View();
        }
        public ActionResult GuideView()
        {

            return View();
        }
        public ActionResult Guide(int limit, int page, string shopId)
        {
            int count;
            var list = cd.GetGuide(limit, page, shopId, out count);

            return Json(new { code = 0, data = list, count = 10, msg = "" }, JsonRequestBehavior.AllowGet);
        }

        public ActionResult AddView()
        {
            return View();
        }
        //public ActionResult Add(Model.Guide guide)
        //{
        //    int res = cd.AddGuide(guide);
        //    if (res > 0)
        //    {
        //        return Json(new { msg = "添加成功" });
        //    }
        //    return Json(new { msg = "添加失败" });
        //}
        public ActionResult EditView(int id)
        {
            var list = cd.GetGuideById(id);
            return View(list);
        }
        //public ActionResult Edit(Model.Guide guide)
        //{
        //    int res = cd.EditGuide(guide);
        //    if (res > 0)
        //    {
        //        return Json(new { msg = "修改成功" });
        //    }
        //    return Json(new { msg = "修改失败" });

        //}
        public ActionResult Del(int id)
        {
            int res = cd.DelGuide(id);
            if (res > 0)
            {
                return Content("成功");
            }
            return Content("失败");

        }

    }
}